package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Setmeal;
import com.itheima.health.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/mobile/setmeal")
public class UserMobileSetmealController {

    @Autowired
    private SetmealService setmealService;

    @GetMapping("/getSetmeal")
    public Result getSetmealAll() {
        List<Setmeal> setmealAllList = setmealService.getSetmealAll();
        return new Result(true, MessageConst.QUERY_SETMEALLIST_SUCCESS,setmealAllList);
    }

    @GetMapping("/findById")
    public Result findById(Integer id){
       Setmeal setmeal = setmealService.findById(id);
       return new Result(true,MessageConst.QUERY_SETMEAL_SUCCESS,setmeal);
    }
}
